package org.zjt.log.exception;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

/**
 * DESC
 *
 * @author
 * @create 2017-06-20 上午11:08
 **/
public class IntWritableComparator extends WritableComparator {
    public IntWritableComparator() {
        super(IntWritable.class, true);
    }

    @SuppressWarnings("rawtypes")
    public int compare(WritableComparable a, WritableComparable b) {

        IntWritable a1 = (IntWritable) a;
        IntWritable a2 = (IntWritable) b;

        return -Integer.compare(a1.get(), a2.get());
    }

}
